/*
 * Copyright 2022 NXP
 * SPDX-License-Identifier: MIT
 */

#include "lvgl/lvgl.h"
#include <stdio.h>
#include "gui_guider.h"
#include "events_init.h"
#include "custom.h"

static lv_obj_t * BreathingLight_spinbox_1;
static void lv_BreathingLight_spinbox_1_increment_event_cb(lv_obj_t * BreathingLight_spinbox_1_btn, lv_event_t event)
{
	if(event == LV_EVENT_SHORT_CLICKED || event == LV_EVENT_LONG_PRESSED_REPEAT){
	lv_spinbox_increment(BreathingLight_spinbox_1);
	}
}
static void lv_BreathingLight_spinbox_1_decrement_event_cb(lv_obj_t * BreathingLight_spinbox_1_btn, lv_event_t event)
{
	if(event == LV_EVENT_SHORT_CLICKED || event == LV_EVENT_LONG_PRESSED_REPEAT){
	lv_spinbox_decrement(BreathingLight_spinbox_1);
	}
}

void setup_scr_BreathingLight(lv_ui *ui){

	//Write codes BreathingLight
	ui->BreathingLight = lv_obj_create(NULL, NULL);

	//Write codes BreathingLight_led_1
	ui->BreathingLight_led_1 = lv_led_create(ui->BreathingLight, NULL);

	//Write style LV_LED_PART_MAIN for BreathingLight_led_1
	static lv_style_t style_BreathingLight_led_1_main;
	lv_style_reset(&style_BreathingLight_led_1_main);

	//Write style state: LV_STATE_DEFAULT for style_BreathingLight_led_1_main
	lv_style_set_radius(&style_BreathingLight_led_1_main, LV_STATE_DEFAULT, 20);
	lv_style_set_bg_color(&style_BreathingLight_led_1_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0xff));
	lv_style_set_bg_grad_color(&style_BreathingLight_led_1_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0xff));
	lv_style_set_bg_grad_dir(&style_BreathingLight_led_1_main, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE);
	lv_style_set_bg_opa(&style_BreathingLight_led_1_main, LV_STATE_DEFAULT, 255);
	lv_style_set_shadow_color(&style_BreathingLight_led_1_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0xa1, 0xb5));
	lv_style_set_shadow_width(&style_BreathingLight_led_1_main, LV_STATE_DEFAULT, 0);
	lv_style_set_border_color(&style_BreathingLight_led_1_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_border_width(&style_BreathingLight_led_1_main, LV_STATE_DEFAULT, 0);
	lv_style_set_border_opa(&style_BreathingLight_led_1_main, LV_STATE_DEFAULT, 255);
	lv_obj_add_style(ui->BreathingLight_led_1, LV_LED_PART_MAIN, &style_BreathingLight_led_1_main);
	lv_obj_set_pos(ui->BreathingLight_led_1, 99, 48);
	lv_obj_set_size(ui->BreathingLight_led_1, 40, 40);
	lv_led_set_bright(ui->BreathingLight_led_1, 200);

	//Write codes BreathingLight_spinbox_1
	ui->BreathingLight_spinbox_1 = lv_spinbox_create(ui->BreathingLight, NULL);

	//Write style LV_SPINBOX_PART_BG for BreathingLight_spinbox_1
	static lv_style_t style_BreathingLight_spinbox_1_bg;
	lv_style_reset(&style_BreathingLight_spinbox_1_bg);

	//Write style state: LV_STATE_DEFAULT for style_BreathingLight_spinbox_1_bg
	lv_style_set_radius(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, 0);
	lv_style_set_bg_color(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_color(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_dir(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
	lv_style_set_bg_opa(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, 255);
	lv_style_set_border_color(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, lv_color_make(0x01, 0xa2, 0xb1));
	lv_style_set_border_width(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, 2);
	lv_style_set_text_color(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
	lv_style_set_text_font(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, &lv_font_simsun_15);
	lv_style_set_text_letter_space(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, 0);
	lv_style_set_pad_left(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, 2);
	lv_style_set_pad_right(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, 0);
	lv_style_set_pad_top(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, 10);
	lv_style_set_pad_bottom(&style_BreathingLight_spinbox_1_bg, LV_STATE_DEFAULT, 10);
	lv_obj_add_style(ui->BreathingLight_spinbox_1, LV_SPINBOX_PART_BG, &style_BreathingLight_spinbox_1_bg);

	//Write style LV_SPINBOX_PART_CURSOR for BreathingLight_spinbox_1
	static lv_style_t style_BreathingLight_spinbox_1_cursor;
	lv_style_reset(&style_BreathingLight_spinbox_1_cursor);

	//Write style state: LV_STATE_DEFAULT for style_BreathingLight_spinbox_1_cursor
	lv_style_set_bg_color(&style_BreathingLight_spinbox_1_cursor, LV_STATE_DEFAULT, lv_color_make(0x01, 0xa2, 0xb1));
	lv_style_set_bg_grad_color(&style_BreathingLight_spinbox_1_cursor, LV_STATE_DEFAULT, lv_color_make(0x01, 0xa2, 0xb1));
	lv_style_set_bg_grad_dir(&style_BreathingLight_spinbox_1_cursor, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
	lv_style_set_bg_opa(&style_BreathingLight_spinbox_1_cursor, LV_STATE_DEFAULT, 255);
	lv_style_set_text_font(&style_BreathingLight_spinbox_1_cursor, LV_STATE_DEFAULT, &lv_font_simsun_12);
	lv_obj_add_style(ui->BreathingLight_spinbox_1, LV_SPINBOX_PART_CURSOR, &style_BreathingLight_spinbox_1_cursor);

	//Write style LV_BTN_PART_MAIN for BreathingLight_spinbox_1
	static lv_style_t style_BreathingLight_spinbox_1_main_child;
	lv_style_reset(&style_BreathingLight_spinbox_1_main_child);

	//Write style state: LV_STATE_DEFAULT for style_BreathingLight_spinbox_1_main_child
	lv_style_set_radius(&style_BreathingLight_spinbox_1_main_child, LV_STATE_DEFAULT, 0);
	lv_style_set_bg_color(&style_BreathingLight_spinbox_1_main_child, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_color(&style_BreathingLight_spinbox_1_main_child, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_dir(&style_BreathingLight_spinbox_1_main_child, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
	lv_style_set_bg_opa(&style_BreathingLight_spinbox_1_main_child, LV_STATE_DEFAULT, 255);
	lv_style_set_border_color(&style_BreathingLight_spinbox_1_main_child, LV_STATE_DEFAULT, lv_color_make(0x01, 0xa2, 0xb1));
	lv_style_set_border_width(&style_BreathingLight_spinbox_1_main_child, LV_STATE_DEFAULT, 2);
	lv_obj_set_pos(ui->BreathingLight_spinbox_1, 96, 210);
	lv_obj_set_width(ui->BreathingLight_spinbox_1, 74);
	lv_spinbox_set_digit_format(ui->BreathingLight_spinbox_1, 4, 2);
	lv_spinbox_step_prev(ui->BreathingLight_spinbox_1);
	lv_spinbox_set_range(ui->BreathingLight_spinbox_1, -99999, 99999);
	BreathingLight_spinbox_1 = ui->BreathingLight_spinbox_1;
	lv_coord_t BreathingLight_spinbox_1_h = lv_obj_get_height(ui->BreathingLight_spinbox_1);
	ui->BreathingLight_spinbox_1_btn = lv_btn_create(ui->BreathingLight, NULL);
	lv_obj_set_size(ui->BreathingLight_spinbox_1_btn, BreathingLight_spinbox_1_h, BreathingLight_spinbox_1_h);
	lv_obj_align(ui->BreathingLight_spinbox_1_btn, ui->BreathingLight_spinbox_1, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
	lv_theme_apply(ui->BreathingLight_spinbox_1_btn, LV_THEME_SPINBOX_BTN);
	lv_obj_set_style_local_value_str(ui->BreathingLight_spinbox_1_btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_SYMBOL_PLUS);
	lv_obj_set_event_cb(ui->BreathingLight_spinbox_1_btn, lv_BreathingLight_spinbox_1_increment_event_cb);
	ui->BreathingLight_spinbox_1_btn_minus = lv_btn_create(ui->BreathingLight, ui->BreathingLight_spinbox_1_btn);
	lv_obj_align(ui->BreathingLight_spinbox_1_btn_minus,ui->BreathingLight_spinbox_1, LV_ALIGN_OUT_LEFT_MID, -5, 0);
	lv_obj_set_event_cb(ui->BreathingLight_spinbox_1_btn_minus, lv_BreathingLight_spinbox_1_decrement_event_cb);
	lv_obj_set_style_local_value_str(ui->BreathingLight_spinbox_1_btn_minus, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_SYMBOL_MINUS);
	lv_obj_add_style(ui->BreathingLight_spinbox_1_btn, LV_BTN_PART_MAIN, &style_BreathingLight_spinbox_1_main_child);
	lv_obj_add_style(ui->BreathingLight_spinbox_1_btn_minus, LV_BTN_PART_MAIN, &style_BreathingLight_spinbox_1_main_child);

	//Write codes BreathingLight_BL_sw_1
	ui->BreathingLight_BL_sw_1 = lv_switch_create(ui->BreathingLight, NULL);

	//Write style LV_SWITCH_PART_BG for BreathingLight_BL_sw_1
	static lv_style_t style_BreathingLight_BL_sw_1_bg;
	lv_style_reset(&style_BreathingLight_BL_sw_1_bg);

	//Write style state: LV_STATE_DEFAULT for style_BreathingLight_BL_sw_1_bg
	lv_style_set_radius(&style_BreathingLight_BL_sw_1_bg, LV_STATE_DEFAULT, 100);
	lv_style_set_bg_color(&style_BreathingLight_BL_sw_1_bg, LV_STATE_DEFAULT, lv_color_make(0xd4, 0xd7, 0xd9));
	lv_style_set_bg_grad_color(&style_BreathingLight_BL_sw_1_bg, LV_STATE_DEFAULT, lv_color_make(0xd4, 0xd7, 0xd9));
	lv_style_set_bg_grad_dir(&style_BreathingLight_BL_sw_1_bg, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
	lv_style_set_bg_opa(&style_BreathingLight_BL_sw_1_bg, LV_STATE_DEFAULT, 255);
	lv_obj_add_style(ui->BreathingLight_BL_sw_1, LV_SWITCH_PART_BG, &style_BreathingLight_BL_sw_1_bg);

	//Write style LV_SWITCH_PART_INDIC for BreathingLight_BL_sw_1
	static lv_style_t style_BreathingLight_BL_sw_1_indic;
	lv_style_reset(&style_BreathingLight_BL_sw_1_indic);

	//Write style state: LV_STATE_DEFAULT for style_BreathingLight_BL_sw_1_indic
	lv_style_set_radius(&style_BreathingLight_BL_sw_1_indic, LV_STATE_DEFAULT, 100);
	lv_style_set_bg_color(&style_BreathingLight_BL_sw_1_indic, LV_STATE_DEFAULT, lv_color_make(0x00, 0xa1, 0xb5));
	lv_style_set_bg_grad_color(&style_BreathingLight_BL_sw_1_indic, LV_STATE_DEFAULT, lv_color_make(0x00, 0xa1, 0xb5));
	lv_style_set_bg_grad_dir(&style_BreathingLight_BL_sw_1_indic, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
	lv_style_set_bg_opa(&style_BreathingLight_BL_sw_1_indic, LV_STATE_DEFAULT, 255);
	lv_obj_add_style(ui->BreathingLight_BL_sw_1, LV_SWITCH_PART_INDIC, &style_BreathingLight_BL_sw_1_indic);

	//Write style LV_SWITCH_PART_KNOB for BreathingLight_BL_sw_1
	static lv_style_t style_BreathingLight_BL_sw_1_knob;
	lv_style_reset(&style_BreathingLight_BL_sw_1_knob);

	//Write style state: LV_STATE_DEFAULT for style_BreathingLight_BL_sw_1_knob
	lv_style_set_radius(&style_BreathingLight_BL_sw_1_knob, LV_STATE_DEFAULT, 100);
	lv_style_set_bg_color(&style_BreathingLight_BL_sw_1_knob, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_color(&style_BreathingLight_BL_sw_1_knob, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_dir(&style_BreathingLight_BL_sw_1_knob, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
	lv_style_set_bg_opa(&style_BreathingLight_BL_sw_1_knob, LV_STATE_DEFAULT, 255);
	lv_obj_add_style(ui->BreathingLight_BL_sw_1, LV_SWITCH_PART_KNOB, &style_BreathingLight_BL_sw_1_knob);
	lv_obj_set_pos(ui->BreathingLight_BL_sw_1, 135, 130);
	lv_obj_set_size(ui->BreathingLight_BL_sw_1, 48, 24);
	lv_switch_set_anim_time(ui->BreathingLight_BL_sw_1, 300);

	//Write codes BreathingLight_label_1
	ui->BreathingLight_label_1 = lv_label_create(ui->BreathingLight, NULL);
	lv_label_set_text(ui->BreathingLight_label_1, "开关");
	lv_label_set_long_mode(ui->BreathingLight_label_1, LV_LABEL_LONG_BREAK);
	lv_label_set_align(ui->BreathingLight_label_1, LV_LABEL_ALIGN_CENTER);

	//Write style LV_LABEL_PART_MAIN for BreathingLight_label_1
	static lv_style_t style_BreathingLight_label_1_main;
	lv_style_reset(&style_BreathingLight_label_1_main);

	//Write style state: LV_STATE_DEFAULT for style_BreathingLight_label_1_main
	lv_style_set_radius(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, 0);
	lv_style_set_bg_color(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_color(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_dir(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
	lv_style_set_bg_opa(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, 255);
	lv_style_set_text_color(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
	lv_style_set_text_font(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
	lv_style_set_text_letter_space(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, 2);
	lv_style_set_pad_left(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, 0);
	lv_style_set_pad_right(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, 0);
	lv_style_set_pad_top(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, 0);
	lv_style_set_pad_bottom(&style_BreathingLight_label_1_main, LV_STATE_DEFAULT, 0);
	lv_obj_add_style(ui->BreathingLight_label_1, LV_LABEL_PART_MAIN, &style_BreathingLight_label_1_main);
	lv_obj_set_pos(ui->BreathingLight_label_1, 50, 130);
	lv_obj_set_size(ui->BreathingLight_label_1, 53, 0);

	//Write codes BreathingLight_label_2
	ui->BreathingLight_label_2 = lv_label_create(ui->BreathingLight, NULL);
	lv_label_set_text(ui->BreathingLight_label_2, "间隔时间");
	lv_label_set_long_mode(ui->BreathingLight_label_2, LV_LABEL_LONG_BREAK);
	lv_label_set_align(ui->BreathingLight_label_2, LV_LABEL_ALIGN_CENTER);

	//Write style LV_LABEL_PART_MAIN for BreathingLight_label_2
	static lv_style_t style_BreathingLight_label_2_main;
	lv_style_reset(&style_BreathingLight_label_2_main);

	//Write style state: LV_STATE_DEFAULT for style_BreathingLight_label_2_main
	lv_style_set_radius(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, 0);
	lv_style_set_bg_color(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_color(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_dir(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
	lv_style_set_bg_opa(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, 255);
	lv_style_set_text_color(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
	lv_style_set_text_font(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
	lv_style_set_text_letter_space(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, 2);
	lv_style_set_pad_left(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, 0);
	lv_style_set_pad_right(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, 0);
	lv_style_set_pad_top(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, 0);
	lv_style_set_pad_bottom(&style_BreathingLight_label_2_main, LV_STATE_DEFAULT, 0);
	lv_obj_add_style(ui->BreathingLight_label_2, LV_LABEL_PART_MAIN, &style_BreathingLight_label_2_main);
	lv_obj_set_pos(ui->BreathingLight_label_2, 50, 180);
	lv_obj_set_size(ui->BreathingLight_label_2, 94, 0);
	lv_anim_path_t lv_anim_path_BreathingLight_btn_1 = {.cb = lv_anim_path_linear};

	//Write codes BreathingLight_btn_1
	ui->BreathingLight_btn_1 = lv_btn_create(ui->BreathingLight, NULL);

	//Write style LV_BTN_PART_MAIN for BreathingLight_btn_1
	static lv_style_t style_BreathingLight_btn_1_main;
	lv_style_reset(&style_BreathingLight_btn_1_main);

	//Write style state: LV_STATE_DEFAULT for style_BreathingLight_btn_1_main
	lv_style_set_radius(&style_BreathingLight_btn_1_main, LV_STATE_DEFAULT, 50);
	lv_style_set_bg_color(&style_BreathingLight_btn_1_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_color(&style_BreathingLight_btn_1_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
	lv_style_set_bg_grad_dir(&style_BreathingLight_btn_1_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
	lv_style_set_bg_opa(&style_BreathingLight_btn_1_main, LV_STATE_DEFAULT, 150);
	lv_style_set_border_color(&style_BreathingLight_btn_1_main, LV_STATE_DEFAULT, lv_color_make(0x01, 0xa2, 0xb1));
	lv_style_set_border_width(&style_BreathingLight_btn_1_main, LV_STATE_DEFAULT, 2);
	lv_style_set_border_opa(&style_BreathingLight_btn_1_main, LV_STATE_DEFAULT, 100);
	lv_style_set_outline_color(&style_BreathingLight_btn_1_main, LV_STATE_DEFAULT, lv_color_make(0xd4, 0xd7, 0xd9));
	lv_style_set_outline_opa(&style_BreathingLight_btn_1_main, LV_STATE_DEFAULT, 50);
	lv_obj_add_style(ui->BreathingLight_btn_1, LV_BTN_PART_MAIN, &style_BreathingLight_btn_1_main);
	lv_obj_set_pos(ui->BreathingLight_btn_1, 95, 320);
	lv_obj_set_size(ui->BreathingLight_btn_1, 50, 50);

	//Write animation: BreathingLight_btn_1move in y direction
	lv_anim_t BreathingLight_btn_1_y;
	lv_anim_init(&BreathingLight_btn_1_y);
	lv_anim_set_var(&BreathingLight_btn_1_y, ui->BreathingLight_btn_1);
	lv_anim_set_time(&BreathingLight_btn_1_y, 300);
	lv_anim_set_exec_cb(&BreathingLight_btn_1_y, (lv_anim_exec_xcb_t)lv_obj_set_y);
	lv_anim_set_values(&BreathingLight_btn_1_y, lv_obj_get_y(ui->BreathingLight_btn_1), 260);
	_lv_memcpy_small(&BreathingLight_btn_1_y.path, &lv_anim_path_BreathingLight_btn_1, sizeof(lv_anim_path_cb_t));
	lv_anim_start(&BreathingLight_btn_1_y);

	ui->BreathingLight_btn_1_label = lv_label_create(ui->BreathingLight_btn_1, NULL);
	lv_label_set_text(ui->BreathingLight_btn_1_label, "<");
	lv_obj_set_style_local_text_color(ui->BreathingLight_btn_1_label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
	lv_obj_set_style_local_text_font(ui->BreathingLight_btn_1_label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_simsun_20);

	//Init events for screen
	events_init_BreathingLight(ui);
}